home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OExamples / Instructions < prev    next >
Encoding:
Text File  |  1995-07-03  |  11.2 KB  |  313 lines  |  [TEXT/MPS ]

  1. Instructions - The Oberon Examples
  2.  
  3. Copyright Jürgen Geßwein 1994
  4. All rights reserved.
  5.  
  6.  
  7. About the Examples
  8.  
  9.     Eight sample Oberon programs are included with MPW Oberon: an
  10.     application, a tool, a desk accessory, and a program that
  11.     demonstrates the use of performance tools:
  12.     
  13.         Sample     - a simple MultiFinder-Aware Sample application
  14.         TESample   - a simple MultiFinder-Aware TextEdit application 
  15.         SillyBalls - a simple Color Quickdraw sample application
  16.                            (Requires Color Quickdraw, e.g. MacII)
  17.         TubeTest   - a simple Color Quickdraw & Palette Manager 
  18.                             Sample application
  19.                             (Requires Color Quickdraw, e.g. MacII)
  20.         ResEqual      - an MPW tool
  21.         DAMemory       - a sample desk accessory
  22.         EditCdev   - a sample Control Panel Device with a TextEdit item 
  23.         TestPerf       - a performance demonstration tool
  24.  
  25.     The source files for each of these examples are in the
  26.     "Examples:OExamples:" folder.  In addition, the makefiles
  27.     containing the commands needed to build each of the
  28.     examples are provided in the same folder.
  29.     
  30.  
  31. Building the Examples
  32.  
  33.     You can easily build each of the sample programs using the Directory
  34.     and Build menus.  (See Chapter 2 of the MPW Reference.)
  35.     
  36.     Set the default directory to "OExamples:"
  37.  
  38.         The simplest way to do this is to select from the Directory menu
  39.         the menu item that ends in "OExamples:".  You can also set the
  40.         default directory by using the Directory and SetDirectory commands.
  41.         
  42.  
  43.     Build the program
  44.     
  45.         You can use any of the four Build items at the bottom of the Build
  46.         menu to build the program you have selected.  Each of these menu
  47.         items displays a dialog box that asks for the name of the program
  48.         you want to build.  When this dialog box appears, type the name of
  49.         one of the sample programs (Sample, TESample, SillyBalls,
  50.         TubeTest, ResEqual, DAMemory, EditCdev or TestPerf).
  51.         
  52.         Each of the Build menu items behaves slightly differently:
  53.         
  54.             Build…  -  The program is automatically built.  The commands
  55.             used, and any error messages, are displayed in the Worksheet.
  56.             Only files that have been changed since you last built the
  57.             program are compiled, saving considerable time.
  58.     
  59.             Full Build…  -  The program is completely rebuilt, ignoring
  60.             any object files or intermediate files that may already exist
  61.             from a previous build.  The commands used, and any errors, are
  62.             displayed in the Worksheet.
  63.             
  64.             Show Build Commands…  -  The commands needed to build the program
  65.             are written to the Worksheet, but not executed.  You can then
  66.             select any or all of the commands and execute them yourself.
  67.             (To execute the commands select them and press Enter.)
  68.             
  69.             Show Full Build Commands…  -  The commands needed to completely
  70.             rebuild the program are written to the Worksheet.  This is a
  71.             convenient way to see all of the commands used in building
  72.             the program you have selected.
  73.  
  74.  
  75.    Note: For more information about building the sample programs, see
  76.    Chapter 2 of the MPW Reference.
  77.  
  78.  
  79.  
  80. Sample - A Simple MultiFinder-Aware Sample Application
  81.  
  82.     Sample is an example application that demonstrates how to initialize
  83.     the commonly used toolbox managers, operate successfully under 
  84.     MultiFinder, handle desk accessories and create, grow, and zoom windows.
  85.     The source for Sample (or TESample below) provides an excellent
  86.     framework for basing new applications.
  87.      The source is contained in the file Sample.mod, resource
  88.     descriptions are contained in the files Sample.h and Sample.r.
  89.     The make dependency file is named Sample.make.
  90.  
  91.    To build Sample, simply select the line below and press Enter.
  92.  
  93.         BuildProgram Sample ∑∑ "{Worksheet}"
  94.  
  95.    To execute Sample, select the line below and press Enter.
  96.  
  97.         Sample
  98.  
  99.  
  100.  
  101. TESample - A Simple MultiFinder-Aware TextEdit Application
  102.  
  103.     TESample is an example application that demonstrates how to initialize
  104.     the commonly used toolbox managers, operate successfully under 
  105.     MultiFinder, handle desk accessories and create, grow, and zoom windows.
  106.     The fundamental TextEdit toolbox calls and TextEdit autoscroll are 
  107.     demonstrated. TESample also shows how to create and maintain scrollbar
  108.     controls.
  109.     The source for TESample (or Sample above) provides an excellent
  110.     framework for basing new applications.
  111.     The source is contained in the files TESample.mod and TESampleGlue.a,
  112.     resource descriptions are contained in the files TESample.h and
  113.     TESample.r. The make dependency file is named TESample.make.
  114.  
  115.    To build TESample, simply select the line below and press Enter.
  116.  
  117.         BuildProgram TESample ∑∑ "{Worksheet}"
  118.  
  119.    To execute TESample, select the line below and press Enter.
  120.  
  121.         TESample
  122.  
  123.  
  124.  
  125. SillyBalls - A Simple Color Quickdraw Sample Application
  126.     
  127.     (Requires Color Quickdraw, e.g. MacII)
  128.  
  129.     SillyBalls is a very simple sample program that demonstrates 
  130.     how to use Color QuickDraw.  It is about two pages of code, and 
  131.     does nothing more than open a color window and draw randomly 
  132.     colored ovals in the window.
  133.     The purpose is to show how to get some initial results with Color 
  134.     QuickDraw. It is a complete program and is very short to be as 
  135.     clear as possible.
  136.     The source is contained in the files SillyBalls.mod.
  137.  
  138.    To build SillyBalls, simply select the line below and press Enter.
  139.  
  140.         BuildProgram SillyBalls ∑∑ "{Worksheet}"
  141.  
  142.    To execute SillyBalls, select the line below and press Enter.
  143.  
  144.         SillyBalls
  145.  
  146.  
  147.  
  148. TubeTest - A Simple Color Quickdraw & Palette Manager Sample Application
  149.  
  150.     (Requires Color Quickdraw, e.g. MacII)
  151.  
  152.     TubeTest is a simple demonstration of how to use 
  153.     the Palette Manager in a color program.  It has a special color 
  154.     palette that is associated with the main window.  The colors are
  155.     animated using the Palette Manager to give a flowing tube effect.
  156.     The program is very simple, and the Palette Manager and drawing 
  157.     parts are put in separate subroutines to make it easier to figure 
  158.     out what is happening.
  159.     The source is contained in the files TubeTest.mod and TubeTest.r
  160.  
  161.    To build TubeTest, simply select the line below and press Enter.
  162.  
  163.         BuildProgram TubeTest ∑∑ "{Worksheet}"
  164.  
  165.    To execute TubeTest, select the line below and press Enter.
  166.  
  167.         TubeTest
  168.  
  169.  
  170.  
  171. ResEqual - A Sample MPW Tool
  172.  
  173.     ResEqual is a sample MPW tool that compares resource files. A
  174.     version of ResEqual is included with MPW, and is documented in
  175.     the MPW Reference.  The source for ResEqual is in the files
  176.     ResEqual.mod, FStubs.a, and ResEqual.r.
  177.  
  178.    To build ResEqual, simply select the line below and press Enter.
  179.  
  180.         BuildProgram ResEqual ∑∑ "{Worksheet}"
  181.  
  182.    To test ResEqual, execute the following lines.
  183.  
  184.       # The following three lines copy ResEqual into Dummy and renumbers
  185.       # one of the resources.
  186.       Echo "include ∂"ResEqual∂" not 'cmdo';" ∂
  187.                "include ∂"ResEqual∂" 'cmdo' (355) as 'cmdo' (356);" ∂
  188.              | Rez -o Dummy -t MPST -c 'MPS '
  189.       ResEqual ResEqual Dummy
  190.  
  191.    ResEqual should report that each file contains a resource not found
  192.     in the other file.
  193.  
  194.  
  195. DAMemory - A Sample Desk Accessory
  196.  
  197.  
  198.    Memory is a sample desk accessory written in Oberon.  It displays the
  199.     memory available in the application and system heaps, and on the boot
  200.     disk.
  201.  
  202.    To build Memory, simply select the line below and press Enter.
  203.  
  204.         BuildProgram DAMemory ∑∑ "{Worksheet}"
  205.  
  206.     NOTE: If you don't have the MPW Assembler, you'll need to select the
  207.             line below and press Enter. You won't be able to use SADE to
  208.             debug DA's built without the assembler though...
  209.  
  210.         BuildProgram Memory.NOASM ∑∑ "{Worksheet}"
  211.         
  212.    The build process puts the desk accessory into a Font/DA Mover file.
  213.    To install the Memory desk accessory, use the Font/DA Mover to copy
  214.    resource Memory from the file Memory into the System file.
  215.    
  216.    After quitting the Font/DA Mover and returning to the MPW Shell, select
  217.    "Memory" from the Apple menu.
  218.  
  219.  
  220.  
  221. EditCdev - A Sample Control Panel Device in Oberon
  222.  
  223.     EditCdev demonstrates how to implement a editText item
  224.     in a Control Panel Device.  It utilizes the new undo, cut, copy,
  225.     paste, and delete messages that are sent to cdevs in
  226.     response to user menu selections.
  227.  
  228.    To build EditCdev, simply select the line below and press Enter.
  229.  
  230.         BuildProgram EditCdev ∑∑ "{Worksheet}"
  231.  
  232.     To execute EditCdev, after building it, simply select the Control
  233.     Panel desk accessory from the Apple menu, and click on the EditCdev
  234.     icon in the list of Control Panel Devices.
  235.     
  236.  
  237.  
  238. TestPerf - An example of Using Performance Tools in Oberon
  239.  
  240.     TestPerf is an MPW tool that demonstrates the use of the performance
  241.     measurement tools.  MakeFile contains the commands for building TestPerf.
  242.  
  243.    To build TestPerf, simply select the line below and press Enter.
  244.  
  245.         BuildProgram TestPerf ∑∑ "{Worksheet}"
  246.  
  247.     To execute TestPerf, select and execute the following command. (This
  248.     test will run about 15 to 60 seconds, depending upon the machine, with
  249.     only internal computations being performed):
  250.     
  251.         TestPerf
  252.  
  253.     TestPerf's raw performance data is written to the file Perform.out.
  254.     In this sample use of the performance measurement tools, the ROM was
  255.     measured.  So the ROM link map file needs to be combined with the program
  256.     link map file.  Because there are three different ROM maps, select and
  257.     execute the line that corresponds to the machine TestPerf was run on:
  258.     
  259.     # For Macintosh Plus:
  260.         Catenate "{MPW}ROM Maps:MacPlusROM.map" >> TestPerf.map
  261.  
  262.     # For Macintosh SE:
  263.         Catenate "{MPW}ROM Maps:MacSEROM.map" >> TestPerf.map
  264.  
  265.     # For Macintosh II:
  266.         Catenate "{MPW}ROM Maps:MacIIROM.map" >> TestPerf.map
  267.  
  268.     PerformReport is an MPW Tool that combines the output of the performance
  269.     tools with the link map file and produces a list of procedures, sorted by
  270.     estimated percent of time spent in each procedure.  To run PerformReport
  271.     execute the following command:
  272.  
  273.         PerformReport -l TestPerf.map -m Perform.Out > Report.Out
  274.  
  275.     The output of PerformReport is written to the file Report.Out.  To examine
  276.     this output, execute the following command:
  277.     
  278.         Open Report.Out
  279.  
  280.  
  281. Writing Your Own Programs
  282.  
  283.     After building (and perhaps modifying) the sample programs, you will
  284.     undoubtedly want to write a program of your own.  Use the New… item in
  285.     the File menu, to create the source files.  Remember that Oberon
  286.     source filenames should end in .mod.
  287.     
  288.     Create Build Commands…  -  The Create Build Commands… item in the 
  289.     Build menu runs a script that creates a makefile containing the
  290.     commands for building programs written in C, Assembly Language, Pascal, 
  291.     and/or Rez.  Selecting Create Build Commands… displays a dialog box that 
  292.     allows you to enter information about your program.  Type the program's
  293.     name, select its source files by clicking the Files… button, and click
  294.     one of the radio buttons to indicate your choice of an application, tool,
  295.     or desk accessory.  
  296.     
  297.     Create Build Commands… puts the makefile for your program in the file
  298.     <program>.make.  Now you can use the Build menu to build and rebuild
  299.     your program, just as with the examples.
  300.     
  301.     Larger Programs  -  If you add source files as your program grows,
  302.     use Create Build Commands… again to add the new source files to the build
  303.     instructions.  If you out-grow the capabilities of the simple Create
  304.     Build Commands… script (perhaps by using tools other than Asm, C, Pascal,
  305.     Rez, and Link in your builds) you can modify the makefile yourself.
  306.     
  307.     Modifying the Directory and Build Menus  -  The Directory and Build
  308.     menus are both implemented using scripts written in the MPW Shell
  309.     command language.  This has the big advantage that you can modify
  310.     or customize them to match the way you work.
  311.  
  312.  
  313.